home *** CD-ROM | disk | FTP | other *** search
/ Cracking 1 / Cracking I..iso / Tools / Debuggery / TRW2000 / PLUGSDK / README.TXT < prev   
Encoding:
Text File  |  2000-02-25  |  5.6 KB  |  196 lines

  1. -------------------------------------------------
  2. Introduce Plug-ins for TRW2000
  3. -------------------------------------------------
  4. Plug-ins is a extension part of TRW2000. It work with
  5. kernel of TRW2000 and other Plug-ins to provide more 
  6. function for user. Plug-ins is dynamic-link with kernel
  7. of TRW2000, this means that it's NOT a internal component,
  8. it can be instead.
  9.  
  10. Plug-ins is flexible, it can go to any target by easy
  11. design, for example, display driver is written as Plug
  12. -ins. In other words, you can develop special debugger
  13. but not need to develop driver, disassemble, assemble, 
  14. screen-interface... Cracker can get more help from this
  15. important property.
  16.  
  17. -------------------------------------------------
  18. Starting to develop your Plug-ins...
  19. -------------------------------------------------
  20. You must have some tools to develop Plug-ins. You need:
  21.  
  22. Visual C++( recommend 6.0 ) 
  23. Win98DDK. 
  24.  
  25. If you haven't it, never mind, download it freely from 
  26. http://www.microsoft.com/ddk
  27. Warning:
  28. YOU MUST MODIFY FILE I386MK.INC
  29. (locate at <98DDK Directory>\INC),
  30.     1.Search STDFLAGS= /c /Zel /Zp8 /Gy ..., 
  31.       modify /Zp8 to /Zp1.
  32.     2.{i386\}.asm{$(_OBJ_DIR)\i386\}.obj:
  33.         $(386_ASSEMBLER) -Fo$(MAKEDIR)\$@ $<
  34.       change it to:
  35.       .asm{$(_OBJ_DIR)\i386\}.obj:
  36.         $(386_ASSEMBLER) -Fo$(MAKEDIR)\$@ $<
  37.  
  38. Then, click icons "Check" or "Free" environment in Windows
  39. start menu, Ok, we can start! 
  40.  
  41. -------------------------------------------------
  42. Compile reference :
  43. -------------------------------------------------
  44. The extension name of Plug-ins is .SYS, it's a WDM driver
  45. in fact. 
  46.  
  47. Before you start, you must have other two files in the
  48. same directory as the source code located at that you will
  49. use:
  50. MAKEFILE and SOURCES ( no extension name ) .
  51.  
  52. MAKEFILE is following as below :
  53.  
  54. ###########################################################
  55. #
  56. # Microsoft Confidential
  57. # Copyright (C) Microsoft Corporation 1995
  58. # All Rights Reserved.
  59. # MAKEFILE for WDM device driver kit
  60. #
  61. ###########################################################
  62.  
  63. #
  64. # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
  65. # file to this component. This file merely indirects to the real make file
  66. # that is shared by all the driver components of the Windows NT DDK
  67. #
  68.  
  69. !INCLUDE $(NTMAKEENV)\makefile.def
  70.  
  71.  
  72. SOURCES is following as below :
  73.  
  74.  
  75. TARGETNAME=xxxx
  76. TARGETTYPE=DRIVER
  77. DRIVERTYPE=WDM
  78. TARGETPATH=.
  79.  
  80. BLDCRT=1
  81.  
  82. INCLUDES=$(BASEDIR)\inc
  83.  
  84. SOURCES=xxxx.CPP( xxxx_2.CPP, xxxx_3.CPP... )
  85.  
  86. I386_SOURCES=xxxx.ASM( xxxx_2.ASM, xxxx_3.ASM... )
  87.  
  88. ( xxxx is the name of your Plug-ins )
  89.  
  90. If you have these files, you type "BUILD" in command line to
  91. create a WDM.
  92. If you choose "Checked Environment", it will make a debug-WDM
  93. in driectory <SOURCES driectory\I386\Checked. If you choose 
  94. "Free Environment", it will make a Release-WDM in
  95. <SOURCES driectory\I386\Free.
  96. The complie result will be log in file BUILD.LOG, the error
  97. message will be log in file BUILD.ERR and warning message will
  98. be log in file BUILD.WRN in the same directory as SOURCES.
  99.  
  100. You can run tool "BUILD" (include in Win98DDK) to compile and
  101. link Plug-ins. 
  102.  
  103. But, there is a strange problem:
  104. BUILD compiled your CPP and create directory ..\I386, but, it
  105. NOT create directory ..\I386\Checked and  ..\I386\Free, it will
  106. show some error message and fail to like. The best simple 
  107. resolving method is: creating directory by yourself.
  108.  
  109. And, if you have a release-WDM, Warning: It include symbol yet. 
  110. To resolve it, you must do:
  111.  
  112. DUMPBIN /HEADERS xxxx.sys |MORE 
  113. record the map-base address of OPTIONAL HEADER VALUES, 
  114. normally it is 0x10000. 
  115. Use command " REBASE -B 0x10000 -X .\Symbol xxxx.sys " to remove
  116. the symbol. 
  117. If you want to get more information, visit related web and newsgroup.
  118. Reference:
  119. Art Baker: The Windows NT Device Driver Book: A Guide for
  120. Programmers, 1997, published by Prentics Hall, INC.
  121.  
  122. The best simple method is copy/paste the sample's MK.BAT and SOURCES
  123. and MAKEFILE as the starting of your plug-ins.
  124.  
  125. -------------------------------------------------
  126. Plug-ins refernce
  127. -------------------------------------------------
  128. Let us begin the first Plug-ins. Every Plug-ins must have 
  129. determinate format following as below:
  130.  
  131. // This file extension name must be .CPP .
  132.  
  133. extern "C" {
  134. #include <wdm.h>
  135. }
  136. //  It define WDM .
  137.  
  138. #include "..\INCLUCE\PLUGS.H"
  139. //  It define the data type and functin prototype .
  140.  
  141. extern "C" NTSTATUS
  142. DriverEntry(IN PDRIVER_OBJECT DriverObject, 
  143.                     IN PUNICODE_STRING RegistryPath);
  144.  
  145. VOID
  146. Plugs_Unload(IN PDRIVER_OBJECT DriverObject);
  147.  
  148. extern "C" NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
  149. {
  150.     NTSTATUS    ntStatus = STATUS_SUCCESS;
  151.  
  152.     DriverObject->DriverUnload = Plug-ins_Unload;
  153.  
  154.     return ntStatus;
  155. }
  156.  
  157. VOID
  158. Plug-ins_Unload(IN PDRIVER_OBJECT DriverObject)
  159. {
  160. }
  161. //  These are WDM format  , every Plug-ins has the same 
  162. //  code . 
  163. /************ Plug-ins Init and Exit routine **************/
  164.  
  165. PLUGS_API* api = 0;
  166. // This is TRW2000 API pointer . Plug-ins call TRW2000's API
  167. // must like this :
  168. //        
  169. //             TRW2000_api->Get_TRW2000_Version ( ) ;
  170. //
  171.  
  172. EXC EXPORT BOOL Plugs_Init ( PLUGS_API* plugsapi )
  173. {
  174.     TRW2000_api = api;
  175.  
  176.     // add your code.
  177.  
  178.     return TRUE;
  179.     // If Return FALSE this Plug-ins will not be load.
  180. }
  181.  
  182. EXC EXPORT BOOL Plugs_Exit ( )
  183. {
  184.     // add your code.
  185.  
  186.     return TRUE;
  187.     // Must return TRUE.
  188. }
  189.  
  190. Ok, if you have problem remaining, see example Plug-ins.
  191.  
  192. End
  193. Copyright(C) 2000. KnlSoft. Inc. 
  194. http://www.knlsoft.com
  195.